package com.sajhasite.domain.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="child_post")
public class ChildPost extends BaseEntity{

	private Long childPostId;
	private String body;
	private Date createdTimeStamp;
	private Date updatedTimeStamp;	
	private Post post;
	private User user;
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="child_post_id")
	public Long getChildPostId() {
		return childPostId;
	}
	public void setChildPostId(Long childPostId) {
		this.childPostId = childPostId;
	}
	@Column(name="body", length=1000, nullable=false)
	public String getBody() {
		return body;
	}
	public void setBody(String body) {
		this.body = body;
	}
	@Column(name="created_timestamp", length=90, nullable=false)
	public Date getCreatedTimeStamp() {
		return createdTimeStamp;
	}
	public void setCreatedTimeStamp(Date createdTimeStamp) {
		this.createdTimeStamp = createdTimeStamp;
	}
	@Column(name="updated_timestamp", length=90, nullable=false)
	public Date getUpdatedTimeStamp() {
		return updatedTimeStamp;
	}
	
	public void setUpdatedTimeStamp(Date updatedTimeStamp) {
		this.updatedTimeStamp = updatedTimeStamp;
	}
	@ManyToOne
	@JoinColumn(name="post_id")
	public Post getPost() {
		return post;
	}
	public void setPost(Post post) {
		this.post = post;
	}
	
	@ManyToOne
	@JoinColumn(name="user_id")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	@Override
	public String toString() {
		return "ChildPost [childPostId=" + childPostId + ", body=" + body
				+ ", createdTimeStamp=" + createdTimeStamp
				+ ", updatedTimeStamp=" + updatedTimeStamp + "]";
	}
	
	
}
